﻿
<script src="~/Scripts/jquery-easyui-extensions/tabs/jeasyui.extensions.tabs.tabState.js"></script>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',border:false,title:'北部'" style="height:100px;border-bottom-width:1px;padding:25px;">
        <a id="btnCheckIsSelected" class="easyui-linkbutton" data-options="iconCls:'icon-add'">判断标签页3是否已被选择</a>
        <a id="btnCheckIsClosable2" class="easyui-linkbutton" data-options="iconCls:'icon-add'">判断标签页2是否可关闭</a>
        <a id="btnCheckIsClosable3" class="easyui-linkbutton" data-options="iconCls:'icon-add'">判断标签页3是否可关闭</a>
        <a id="btnCheckIsDisabled" class="easyui-linkbutton" data-options="iconCls:'icon-add'">判断标签页1是否被禁用</a>
    </div>
    <div data-options="region:'center',border:false,title:'中间'">
        <div id="tabs1" class="easyui-tabs" data-options="fit:true,border:false">
            <div data-options="title:'标签页1',closable:false,iconCls:'icon-add'" style="padding:15px;">
                标签页1
                <br />
                <a id="btnDisableTab_1" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">禁用当前标签页</a>
            </div>
            <div data-options="title:'标签页2',closable:true,iconCls:'icon-edit',selected:true" style="padding:15px;">
                标签页2
                <br />
                <a id="btnDisableTab_2" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">禁用当前标签页</a>
            </div>
            <div data-options="title:'标签页3',closable:false,iconCls:'icon-remove'" style="padding:15px;">
                标签页3
                <br />
                <a id="btnDisableTab_3" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">禁用当前标签页</a>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {

        $("#btnCheckIsSelected").click(function () {
            var tabs = $("#tabs1");
            var opts = tabs.tabs("isSelected", "标签页3");
            alert("标签页3" + (opts ? "已经" : "没有") + "被选择");
        });

        $("#btnCheckIsClosable2").click(function () {
            var tabs = $("#tabs1");
            var opts = tabs.tabs("isClosable", "标签页2");
            alert("标签页2" + (opts ? "可以" : "无法") + "被关闭");
        });

        $("#btnCheckIsClosable3").click(function () {
            var tabs = $("#tabs1");
            var opts = tabs.tabs("isClosable", "标签页3");
            alert("标签页3" + (opts ? "可以" : "无法") + "被关闭");
        });

        $("#btnCheckIsDisabled").click(function () {
            var tabs = $("#tabs1");
            var opts = tabs.tabs("isDisabled", "标签页1");
            alert("标签页1" + (opts ? "已经" : "没有") + "被禁用");
        });

        $("a[id^='btnDisableTab']").click(function () {
            var id = $(this).attr("id"), order = id.split("_")[1];
            $("#tabs1").tabs("disableTab", "标签页" + order);
        });

    });
</script>

